package com.xbongbong.saas.enums;

import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 列表页底部按钮
 *
 * @author zcp
 */
@Getter
public enum ListBottomButtonEnum {
    // 列表页底部按钮
    //客户对账单 - 打印
    CUSTOMER_STATEMENT_PRINT(XbbRefTypeEnum.CUSTOMER_STATEMENT.getCode(), SaasButtonEnum.PRINT, ProPermissionAliasEnum.CUSTOMER_STATEMENT_PRINT.getAlias()),
    //客户对账单 - 导出
    CUSTOMER_STATEMENT_EXPORT(XbbRefTypeEnum.CUSTOMER_STATEMENT.getCode(), SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_STATEMENT_EXPORT.getAlias()),
    // 添加到对账单列表
    CUSTOMER_STATEMENT_ADD(XbbRefTypeEnum.CUSTOMER_STATEMENT.getCode(), SaasButtonEnum.STATEMENT_ADD, ProPermissionAliasEnum.CUSTOMER_STATEMENT_ADD.getAlias()),
    ;


    private Integer businessType;
    private SaasButtonEnum anEnum;
    private String proPermissionAlias;

    ListBottomButtonEnum(Integer businessType, SaasButtonEnum anEnum, String proPermissionAliasEnum) {
        this.businessType = businessType;
        this.anEnum = anEnum;
        this.proPermissionAlias = proPermissionAliasEnum;
    }

    public static List<ListBottomButtonEnum> getByBusinessType(Integer businessType) {
        List<ListBottomButtonEnum> list = new ArrayList<>();
        for (ListBottomButtonEnum buttonEnum : ListBottomButtonEnum.values()) {
            if (Objects.equals(businessType, buttonEnum.getBusinessType())) {
                list.add(buttonEnum);
            }
        }
        return list;
    }
}
